<template>
  <div>
    <el-container>
      <el-header class="header_container">
        <div class="header_title">NUI-ADMIN</div>
        <div class="header_menus">
          <el-menu
            :default-active="activeIndex"
            class="el-menu-demo"
            mode="horizontal"
            @select="handleSelect"
            background-color="#555C64"
            active-text-color="gold"
            text-color="#fff"
          >
            <el-menu-item index="/homePage">首页</el-menu-item>
            <el-menu-item index="/goods">商品</el-menu-item>
            <el-menu-item index="/order">订单</el-menu-item>
            <el-menu-item index="/vip">会员</el-menu-item>
            <el-menu-item index="/set">设置</el-menu-item>
            <el-submenu index="2">
              <template slot="title">
                <div class="header_user_pic"></div>
                admin</template
              >
              <el-menu-item index="2-1">修改</el-menu-item>
              <el-menu-item index="2-2" @click="out">退出</el-menu-item>
            </el-submenu>
          </el-menu>
        </div>
      </el-header>
      <router-view />
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeIndex: "/order",
    };
  },
  methods: {
    handleSelect(path) {
      // console.log(Path);
      this.$router.push(path);
    },
    out() {
      localStorage.removeItem("user");
      this.$cookies.remove('token')
      this.$router.push("/login");
    },
  },
};
</script>

<style scoped>
.el-header,
.el-footer {
  background-color: #555c64;
  color: #333;
  height: 10vh;
  color: #fff;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.header_container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header_user_pic {
  display: inline-block;
  width: 30px;
  height: 30px;
  background-color: #eee;
  border-radius: 30px;
  margin-right: 5px;
}
</style>